package com.servlet.JeuDeLaBiere;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.servlet.JeuDeLaBiere.Model.Main;

public class ServletMiseAJourDebutPartie extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
//		try {
//			this.wait(5000);
//		} catch (InterruptedException e) {
//		}
		
		
		String nomPartie=(String) req.getParameter("nomPartie");
		ServletContext context=this.getServletContext();
		Main serveur=(Main)context.getAttribute("Serveur");
		if(!serveur.placesLibres(nomPartie)) {
			resp.setContentType("text/html");
			PrintWriter out = resp.getWriter();
			out.println("<div id='LaModif' />");
		}
	}
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}
}
